﻿using System;
using System.Data;
using System.Text;
using Web.Class;
using BLL;
using BLL.Access;
using Entity;
using System.IO;

namespace Web.Pages.YongShui._7.QiTaGL
{
    public partial class ZlsDyhQD : BasePage
    {
        #region 属性
        /// <summary>
        /// 获取银行批量代理汇总记录
        /// </summary>
        private DataTable dtSource
        {
            get
            {
                return ViewState["dtSourceZLSDYHQD"] as DataTable;
            }
            set
            {
                ViewState["dtSourceZLSDYHQD"] = value;
            }
        }
        #endregion
        #region 变量

        /// <summary>
        /// 数据访问操作类
        /// </summary>
        private SpHelper _spHelper = new SpHelper();
        private BLL.SqlHelper _splHelper = new BLL.SqlHelper();

        #endregion

        #region 事件
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
        }

        protected void txtQuery_Click(object sender, EventArgs e)
        {
            Query();
        }

        protected void btnOutExcel_Click(object sender, EventArgs e)
        {
            this.grd.DataSource = this.dtSource;
            this.grd.DataBind();
            grdOutExcel.GridViewID = "grd";
            string sName = "供水分公司传输站点清单" + txtYM.Text;
            grd.Settings.ShowFooter = false;
            grdOutExcel.WriteXlsToResponse(sName);
        }

        #endregion

        #region 私有方法

        private void InitData()
        {
            txtYM.Text = BusinessTool.YS_GETSETTINGSVALUE(eSETTINGS_KEYNAME.WATER_Y_M.ToString());
        }

        private void Query()
        {
            this.dtSource = _splHelper.P_YSCX_ZLSDYHQD(Convert.ToInt32(txtYM.Text)).Tables[0];
            this.grd.DataSource = this.dtSource;
            this.grd.DataBind();
        }

        #endregion
    }
}
